<?php
$appid = '98';
$ver = '3.1.2';
$pt = '2';
require_once S_ROOT.'source/data/eye_seckill98.php';
$memcache_obj = get_memcache();
$uid = $_COOKIE['uid'];
$uid = $memcache_obj->get("user_".$uid);
if(!$uid){
    header("Location: /wx.php?tp=login");
}
$tpl->assign('uid',$uid);
require_once S_ROOT.'source/data/share_config'.$appid.'.php';
$shareinfo = $shareconfig_data['0'];
$share['title'] = $shareinfo['title'];
$share['icon'] = $shareinfo['icon'];
$share['content'] = $shareinfo['content'];
$share['surl_id'] = $shareinfo['surl_id'];
//$share['link'] = $shareinfo['link']."&uid={$uid}&pt={$pt}&ver={$ver}&appid={$appid}";   
$share['link'] ="http://a.tttj.3z.cc/wx.php?tp=find";
$tpl->assign('share',$share);
$appname = getappname($appid);
$tpl->assign("appname",$appname);

//邀请人数
$invitenum = getinvitenum();
$tpl->assign("invitenum",$invitenum);

//获得邀请奖励
$reward = getreward();
$tpl->assign("reward",$reward);

$tpl->display("wx/templates/{$tp}.html");

function getinvitenum()
{
    global $uid;
    if ($uid==0)
    {
        return 0;
    }   
    $sql = "select count(*) as invitenum from tttj.userinfo where master=$uid";
    $info = getonerecord($sql);
    return (int)$info['invitenum'];
}

function getreward()
{
    global $uid;
    $sql = "select sum(cash) as hbcash from tttj.reghb where uid=$uid";
    $hbinfo = getonerecord($sql);
    $hbcash = (int)$hbinfo['hbcash'];
    return $hbcash;
}
?>